<!DOCTYPE html>
<html lang="zh">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://cdn.staticfile.net/vue/2.7.8/vue.js"></script>
    <link href="../css/style.css" rel="stylesheet">
</head>

<body>
<div id="app">
    <div>
        <label for="userName">用户名</label>
        <input type="text" id="userName" placeholder="请输入用户名" v-model="name">
    </div>
    <hr>
    <say-hello :username="name"></say-hello>
</div>
<script>
    Vue.component('say-hello', {
        props: ['username'],
        template: `
          <div>
          你好，<strong>{{ username }}</strong>
          </div>`
    })
    const vm = new Vue({
        el: '#app',
        data: {
            name: ''
        }
    });
</script>
</body>
</html>